package com.cloudptt.api.product.func.media.device;

import com.cloudptt.api.product.log.Log;


public class DeviceKeyInfo {

	private static IDeviceKey dev = null;
	
	public static IDeviceKey getInfo()
	{
		if(dev == null)
		{
			dev = newDev();
		}
		return dev;
	}
	private static IDeviceKey newDev()
	{
		String brand = android.os.Build.BRAND;
		String device = android.os.Build.DEVICE;
		String model = android.os.Build.MODEL;
		Log.debug(DeviceKeyInfo.class, "BRAND = " + brand + " DEVICE = " + device  + " MODEL = " + model);
		if(brand == null
				|| device == null
				|| model == null)
		{
			Log.debug(DeviceKeyInfo.class, "DefaultDev");
			return new DefaultDevKey();
		}
		else if(H200P.isThisDev(brand,device,model))
		{
			Log.debug(DeviceKeyInfo.class, "H200P");
			return new H200P();
		}
		else if(YT9000.isThisDev(brand,device,model))
		{
			Log.debug(DeviceKeyInfo.class, "YT9000");
			return new YT9000();
		}
		else if(F5Q.isThisDev(brand,device,model))
		{
			Log.debug(DeviceKeyInfo.class, "F5Q");
			return new F5Q();
		}
		else if(DtYellow.isThisDev(brand,device,model))
		{
			Log.debug(DeviceKeyInfo.class, "DtYellow");
			return new DtYellow();
		}
		else
		{
			Log.debug(DeviceKeyInfo.class, "DefaultDev");
			return new DefaultDevKey();
		}
	}
	
	public static String getDevStr()
	{
		String brand = android.os.Build.BRAND;
		String device = android.os.Build.DEVICE;
		String model = android.os.Build.MODEL;

		StringBuffer strBuf = new StringBuffer("DevStr  ");
		strBuf.append("BRAND = ").append(brand).append(" ");
		strBuf.append("DEVICE = ").append(device).append(" ");
		strBuf.append("MODEL = ").append(model).append(" ");
		
		return strBuf.toString();
	}
}
